package org.judo.admin;

import bsh.EvalError;
import bsh.Interpreter;

public class Test
{
	public static void main(String s[])
	{
		Interpreter i = new Interpreter();
		
		try
		{
			String code = "public class Tester{\n";
			code += "public void test(){\n";
			code += "System.out.println(var1);\n";
			code += "}\n";
			code += "}\n";
			
			code += "public class Tester2{\n";
			code += "public void test2(){\n";
			code += "System.out.println(\"===\"+var2);\n";
			code += "}\n";
			code += "}\n";
			
			code += "Tester tester = new Tester();\n";
			code += "tester.test();\n";
			code += "Tester2 tester2 = new Tester2();\n";
			code += "tester2.test2();\n";
			
			i.set("var1","This is a variable");
			i.set("var2","This is another variable");
			i.eval(code);
		} 
		catch (EvalError e)
		{
			e.printStackTrace();
		}
	}
}
